<?php
/**
 * Cookie操作类
 */
class Cookie
{
	/**
     * 设置系统COOKIE
     */
	public static function Set($name,$value,$expire=NULL,$path='/',$domain=NULL,$secure=0)
	{
		if(empty($name)) throw new Exception($_SERVER["SCRIPT_NAME"].' Class.Cookeis.Set出错', '请指定Cookie的名称。');

		setcookie($name,$value,$expire,$path,$domain,$secure);
	}

	/**
     * 获取系统COOKIE
     */
	public static function Get($name)
	{
		if(empty($name)) throw new Exception($_SERVER["SCRIPT_NAME"].' Class.Cookeis.Get出错', '请指定Cookie的名称。');

		    return Functions::CookieArgs($name);
	}

	/**     
     * 注销Cookies
     */
	public static function Delete($name=NULL,$path='/',$domain=NULL,$secure=0)
	{
        if($name){
            
            setcookie($name,NULL,NULL,$path,$domain,$secure);            
        }
        else
        {
            foreach($_COOKIE as $name=>$value){
                setcookie($name,NULL,NULL,$path,$domain,$secure);
            }
        }
	}
}
?>
